package edu.jit.mapper;

import edu.jit.entity.Good;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface GoodMapper {
    @Select("SELECT * FROM t_goods WHERE id = #{id}")
    Good findById(Long id);

    @Update("UPDATE t_goods SET name=#{name}, description=#{description}, " +
            "discount=#{discount}, sales=#{sales}, sale_money=#{saleMoney}, " +
            "id=#{categoryId}, imgs=#{imgs}, recommend=#{recommend} WHERE id=#{id}")
    int update(Good good);

    @Delete("DELETE FROM t_goods WHERE id = #{id}")
    int deleteById(Long id);
}
